home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
CRS
/
crs56.d81
/
linkfrmt.seq
< prev
next >
Wrap
Text File
|
2009-10-10
|
7KB
|
126 lines
╨LEASE WAIT WHILE ╔ RELOAD TABS
╞ROM PRINDLE@NADC.ARPA ╘HU ─EC 7 11:25:28 1989
╥ETURN-╨ATH: <PRINDLE@NADC.ARPA>
─ATE: ╘HU, 7 ─EC 89 08:36:55 ┼╙╘
╞ROM: PRINDLE@NADC.ARPA (╞RANK ╨RINDLE)
╘O: ACLIU@SKAT.USC.EDU
╙UBJECT: ╥E: ╨OWER-├ ╧BJECT FORMAT
╧K, HERE IS A COPY OF MY POSTING ON THIS SUBJECT FROM A YEAR OR SO AGO - HOPE
IT HELPS, ┴LEX....
----------------------------------------------------------------------
╚ERE IS, AS ╔ RECALL IT, THE FORMAT OF A ├ ╨OWER (┴╦┴ ╨OWER ├) RELOCATABLE
OBJECT (I.E. A ".O" OR ".OBJ") FILE; OTHERS, PLEASE CORRECT ME IF THIS IS
WRONG, THOUGH ╔ CHECKED IT OUT WITH THE ├ ╨OWER ASSEMBLER (┴╙╙═) SOURCE CODE
AND THE ├ ╨OWER REVERSE ASSEMBLER (╥┴) SOURCE CODE:
╘HERE ARE 5 DISTINCT PARTS TO THE OBJECT FILE; EACH PART BEGINS WITH A 2 BYTE
COUNT IN STANDARD 6502 LOW-BYTE/HI-BYTE FORMAT. ╘HE 5 PARTS DIRECTLY FOLLOW
EACH OTHER IN THE FOLLOWING ORDER:
1. RELOCATABLE OBJECT CODE
2. RELOCATION ENTRIES
3. EXTERNAL DEFINITION ENTRIES
4. EXTERNAL REFERENCE ENTRIES
5. UNINITIALIZED DATA BLOCK ENTRIES
╔ WILL DESCRIBE EACH PART IN DETAIL:
1. RELOCATABLE OBJECT CODE:
╘HE FIRST 2 BYTES ARE A BYTE COUNT OF THE OBJECT CODE TO FOLLOW. ╫HAT
FOLLOWS IS SIMPLY THE GENERATED OBJECT CODE FOR THE CORRESPONDING SOURCE
CODE FILE. ╞OR THOSE INSTRUCTIONS AND .BYTE OR .WORD PSEUDO OPS WHICH
REFERENCE RELOCATABLE ADDRESSES WITHIN A FUNCTION (TYPICALLY FOR LOCAL
JUMPS), THE VALUE IN THE OPERAND FIELD IS THE OFFSET RELATIVE TO THE
FIRST WORD OF OBJECT CODE. ╞OR THOSE INSTRUCTIONS AND .BYTE OR .WORD
PSEUDO OPS WHICH REFERENCE EXTERNALLY DEFINED ADDRESSES, THE VALUE OF
THE OPERAND FIELD IS IRRELEVANT AND TYPICALLY FILLED IN BY THE COMPILER
WITH BYTES WHICH DUPLICATE THE BYTE WHICH IMMEDIATELY PRECEEDS THEM.
╘HIS PART ENDS WHEN THE NUMBER OF BYTES OF OBJECT CODE SPECIFIED IN THE
COUNT HAVE BEEN ENCOUNTERED.
2. RELOCATION ENTRIES:
╘HE FIRST 2 BYTES ARE A COUNT OF THE NUMBER OF RELOCATION ENTRIES TO
FOLLOW. ┼ACH RELOCATION ENTRY IS EXACTLY 2 BYTES LONG AND CONSISTS OF
AN OFFSET RELATIVE TO THE FIRST BYTE OF OBJECT CODE. ╘HIS OFFSET
ACTUALLY POINTS TO THE BYTE BEFORE A 2-BYTE ADDRESS WHICH IS TO HAVE
ADDED TO IT THE ABSOLUTE ADDRESS OF THE FIRST WORD OF OBJECT CODE; THAT
IS, FOR 3-BYTE INSTRUCTIONS, THIS OFFSET POINTS TO THE OP-CODE PRECEED-
ING AN ADDRESS TO BE RELOCATED; FOR 2-BYTE ADDRESSES WITHOUT AN OP-CODE
(E.G. .WORD PSEUDO OPS), THE OFFSET POINTS TO THE BYTE BEFORE THE
ADDRESS TO BE RELOCATED. 1-BYTE ADDRESSES TO BE RELOCATED (E.G. >ADDR
OR <ADDR) ARE NOT HANDLED BY THIS RELOCATION MECHANISM, BUT RATHER AS
PSEUDO EXTDEFS/EXTREFS (SEE BELOW). ╘HIS PART ENDS WHEN THE NUMBER OF
2-BYTE RELOCATION ENTRIES SPECIFIED IN THE COUNT HAVE BEEN ENCOUNTERED.
3. EXTERNAL DEFINITION ENTRIES
╘HE FIRST 2 BYTES ARE A COUNT OF THE NUMBER OF EXTERNAL DEFINITION
ENTRIES TO FOLLOW. ┼ACH EXTDEF ENTRY IS A VARIABLE NUMBER OF BYTES
LONG. ╞IRST APPEARS THE EXTERNALLY DEFINED NAME, TERMINATED WITH A
ZERO BYTE. ╬EXT IS A 1-BYTE FLAG; IF THIS FLAG IS 0, THE EXTERNALLY
DEFINED SYMBOL HAS AN ABSOLUTE VALUE; IF THIS FLAG IS A 1, THE EXTERNAL-
LY DEFINED SYMBOL HAS A RELOCATABLE VALUE RELATIVE TO THE FIRST BYTE
OF OBJECT CODE. ╞INALLY, THE LAST 2 BYTES OF EACH ENTRY ARE THE
ABSOLUTE VALUE OF THE (ABSOLUTE) SYMBOL, OR THE OFFSET OF THE (RELOC-
ATABLE) SYMBOL. ╫HENEVER THE COMPILER MUST REFERENCE ONLY THE LOW OR
HIGH BYTE ADDRESS OF A LOCAL PIECE OF STATIC DATA (E.G. A STRING
LITERAL), THAT DATUM IS GIVEN A "PSEUDO" EXTERNAL DEFINITION; THAT IS,
THE COMPILER MAKES UP A NAME FOR IT CONSISTING OF SEVERAL RANDOMLY
GENERATED SPECIAL CHARACTERS AND ADDITIONAL IDENTIFIER CHARACTERS,
THEN TREATS IT AS IF IT WERE AN EXTERNAL DEFINITION. ╘HIS IS DONE SO
THAT IT MAY BE REFERENCED BY AN EXTERNAL REFERENCE ENTRY TO FOLLOW.
╘HIS PART ENDS WHEN THE NUMBER OF MULTI-BYTE EXTDEF ENTRIES
SPECIFIED IN THE COUNT HAVE BEEN ENCOUNTERED.
4. EXTERNAL REFERENCE ENTRIES:
╘HE FIRST 2 BYTES ARE A COUNT OF THE NUMBER OF EXTERNAL REFERENCE
ENTRIES TO FOLLOW. ┼ACH EXTREF ENTRY IS A VARIABLE NUMBER OF BYTES
LONG. ╞IRST APPEARS THE EXTERNALLY REFERENCED NAME, TERMINATED WITH
A ZERO BYTE. ╬EXT IS A 2-BYTE WORD IN LOW/HI FORMAT; THE LOW 2 BITS
OF THIS WORD INDICATE IF THIS EXTERNAL REFERENCE IS TO A FULL 2-BYTE
ADDRESS (FLAG=0), A SINGLE BYTE TO CONTAIN THE HIGH BYTE OF THE ADDRESS
(FLAG=1), OR A SINGLE BYTE TO CONTAIN THE LOW BYTE OF THE ADDRESS (FLAG=
2). ╘HE UPPER 14 BITS OF THIS WORD ARE AN OFFSET INTO THE EXTERNAL
OBJECT. ╞INALLY, THE LAST 2 BYTES OF EACH ENTRY ARE THE OFFSET OF THE
EXTERNAL REFERENCING INSTRUCTION (POINTS 1 BYTE BEFORE THE EXTERNAL
ADDRESS REFERENCE ITSELF) RELATIVE TO THE FIRST BYTE OF OBJECT CODE.
╔N THE CASE OF REFERENCES TO "PSEUDO" EXTERNAL DEFINITIONS, THE
REFERENCE WILL BE RESOLVED BY THE MATCHING EXTERNAL DEFINITION, AND
THE FLAG WILL ALWAYS BE EITHER 1 OR 2. ╘HIS PART ENDS WHEN THE NUMBER
OF MULTI-BYTE EXTREF ENTRIES SPECIFIED IN THE COUNT HAVE BEEN
ENCOUNTERED.
5. UNINITIALIZED DATA BLOCK ENTRIES:
╘HE FIRST 2 BYTES ARE A COUNT OF THE NUMBER OF DATA BLOCK ENTRIES
TO FOLLOW. ┼ACH DATA BLOCK ENTRY IS A VARIABLE NUMBER OF BYTES
LONG. ╞IRST APPEARS THE DATA BLOCK NAME, TERMINATED WITH A ZERO
BYTE. ╠ASTLY IS A 2-BYTE SIZE, REPRESENTING THE NUMBER OF DATA
BYTES TO BE RESERVED BY THE LINKER (AND ZEROED BY THE RUN-TIME
INITIALIZATION CODE) FOR THAT NAMED DATA BLOCK. ╘HESE ENTRIES ARE
USED TO REPRESENT UNINITIALIZED STATIC OR EXTERNAL DATA TO PREVENT
LARGE OBJECT MODULES FILLED WITH NOTHING BUT ZEROS. ╙INCE THE
DATA BLOCK NAMES ARE EFFECTIVELY EXTERNALLY DEFINED, DUMMY "PSEUDO"
EXTDEF NAMES ARE AGAIN CREATED WHEN LOCAL STATIC DATA IS TO BE
ALLOCATED AS AN UNINITIALIZED DATA BLOCK. ╘HE PURPOSE OF THESE
RANDOMLY GENERATED DUMMY NAMES IS TO CLUE THE LINKER THAT THESE ARE
NOT REAL EXTERNAL DEFINITIONS, AND TO PREVENT EXTERNAL NAME CONFLICT
WITH IDENTICALLY NAMED LOCAL DATA IN OTHER OBJECT MODULES. ╘HIS PART
ENDS WHEN THE NUMBER OF MULTI-BYTE DATA BLOCK ENTRIES SPECIFIED IN THE
COUNT HAVE BEEN ENCOUNTERED. ┴T THIS POINT THE OBJECT FILE IS AT
END-OF-FILE.
╔ HOPE THE ABOVE IS A REASONABLY COMPLETE AND USEFUL DESCRIPTION OF ├ ╨OWER
OBJECT CODE. ╥EFER ALSO TO THE ╘RANSACTOR (═ARCH 1988) ARTICLE "╘HE LINK
BETWEEN ├ AND ASSEMBLY". ┴LSO NOTE THAT ┴╙╙═ FAITHFULLY ADHERES TO THE ABOVE
FORMAT SO THAT ┴╙╙═ GENERATED OBJECT FILES MAY DIRECTLY BE LINKED WITH THOSE
GENERATED BY ├ ╨OWER; HOWEVER, ┴╙╙═ USES A DIFFERENT ALGORITHM FOR THE
GENERATION OF PSEUDO EXTDEF NAMES, ATTEMPTING TO MAKE THOSE NAMES MORE
READABLE WITHOUT SACRIFICING THEIR UNIQUENESS.
╙INCERELY,
╞RANK ╨RINDLE
╨RINDLE@╬┴─├.ARPA